package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.SignUpRoomTypeCount;
import com.eling.elcms.travel.service.ISignUpRoomTypeCountManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SignUpRoomTypeCountController extends BaseFormController{

	@Autowired
	private ISignUpRoomTypeCountManager signUpRoomTypeCountManager;
	
	@RequestMapping("/api/signuproomtypecount/save")
	@ResponseBody
	public SignUpRoomTypeCount save(@ModelAttribute @ModelFilling SignUpRoomTypeCount signUpRoomTypeCount){
		return signUpRoomTypeCountManager.save(signUpRoomTypeCount);
	}
	
	@RequestMapping("/api/signuproomtypecount/{pkSignUpRoomTypeCount}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkSignUpRoomTypeCount){
		signUpRoomTypeCountManager.remove(pkSignUpRoomTypeCount);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/signuproomtypecount/query")
	@ResponseBody
	public List<SignUpRoomTypeCount> query(@ModelAttribute SignUpRoomTypeCount cond){
		return signUpRoomTypeCountManager.query(cond);
	}
	
	@RequestMapping("/api/signuproomtypecount/search*")
	@ResponseBody
	public List<SignUpRoomTypeCount> search(@ModelAttribute SearchCondition sc,@ModelAttribute SignUpRoomTypeCount cond ){
		sc.setQueryCondition(cond);
		return signUpRoomTypeCountManager.search(sc);
	}
}
